<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * 系统权限数据模型
 * @package App\Models
 */
class SysPermission extends Model
{
    use SoftDeletes;
    //主键
    protected $primaryKey = 'perm_id';
    protected $dateFormat = 'Y-m-d H:i:s';
    /**
     * 获取所有角色
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function roles()
    {
        return $this->belongsToMany('App\Models\SysRole','sys_permission_roles','perm_id','role_id')->withTimestamps();
    }
}
